package org.eclipseuseradmin.internal.demo.model;

import org.eclipseuseradmin.internal.demo.ICustomer;
import org.eclipseuseradmin.ui.model.UserModel;
import org.osgi.service.useradmin.UserAdmin;

public class CustomerModel extends UserModel {

	private String address;
	
	public CustomerModel(UserAdmin userAdmin) {
		super(userAdmin);
	}
	
	public CustomerModel(UserAdmin userAdmin, ICustomer customer) {
		super(userAdmin, customer);
	}

	public String getAddress() {
		if (password != null) {
			return password;
		}
		if (roleElement != null) {
			return getCustomer().getPassword();
		}
		return null;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	private ICustomer getCustomer() {
		return (ICustomer) roleElement;
	}
}
